<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:p="http://primefaces.org/ui">

	<ui:composition template="/faces/manager/xhtml/templates/template.xhtml">
		<ui:define name="manager-content">
			<table id="manager-content-panel" cellpadding="0" cellspacing="1">
				<tr>
					<td id="manager-content-header">
						<h:form>	
							<p:breadCrumb style="width:810px;">
								<p:menuitem value="#{msg['manager.menu.navigator.home']}"/>
								<p:menuitem ajax="false" value="#{msg['manager.menu.navigator.admin']}" action="/faces/manager/xhtml/main.xhtml"  />
								<p:menuitem value="#{msg['manager.menu.navigator.servico']}" />
							</p:breadCrumb>			
						</h:form>
					</td>
				</tr>
				<tr>
					<td id="manager-content-body">
						<h:form id="formServico">	
							<p:growl id="showMessages" showDetail="true" />
							<p:fieldset legend="#{msg['manager.menu.left.admin.servico.title']}" styleClass="manager-fieldset-content">
								<table id="panel-buttons" cellpadding="0" cellspacing="0">
									<tr>
										<td>
											<p:commandButton value="#{msg['manager.servico.button.create']}" 
												action="#{servicoController.create}" ajax="false" icon="add-button"/>
											<p:spacer width="10px"/>
											<p:commandButton value="#{msg['manager.servico.button.update']}" id="button-alterar"
												action="#{servicoController.edit}" ajax="false" icon="edit-button" disabled="#{!servicoController.selectedServico}" />
										</td>
									</tr>
								</table>
								<p:spacer height="10px"/>
							 	<p:dataTable 
									var="servico" 
									value="#{servicoController.lazyModelServico}"  
									rows="#{servicoController.pageSize}" 
									paginator="true"
								
									selection="#{servicoController.servico}"
									emptyMessage="#{msg['messages.list.not.found']}">
									
									<p:ajax event="rowSelect" update=":formServico:button-alterar" listener="#{servicoController.onSelectedRow}"/>
									<p:ajax event="page" update=":formServico:button-alterar" listener="#{servicoController.onPaged}"/>  
									<p:column selectionMode="single"  style="width:18px" />
									  
									<p:column headerText="#{msg['manager.servico.list.grid.column.nome']}" >
										<h:outputText value="#{servico.nome}" />
									</p:column>
									
									<p:column headerText="#{msg['manager.servico.list.grid.column.descricao']}">
										<h:outputText value="#{servico.descricao}" />
									</p:column>		
									
									<p:column headerText="#{msg['manager.servico.list.grid.column.status']}">
										<h:outputText value="#{msg['manager.servico.list.label.ativo']}" rendered="#{servico.ativo}"  />
										<h:outputText value="#{msg['manager.servico.list.label.inativo']}" rendered="#{!servico.ativo}"  />
									</p:column>	
															
								</p:dataTable>
								<p:spacer height="10px"/>								
							</p:fieldset>
						</h:form>
					</td>
				</tr>
			</table>
		</ui:define>
	
	</ui:composition>
</html>